
import React from "react";
import {Form,Input} from "antd";
import {diffProps} from "../../libs/funcs";

/**
 * 密码输入框
 */
class FormPasswordInput extends React.Component{

    constructor(props) {
        super(props);
        this.state={}
    }

    render() {
        const {getFieldDecorator} = this.props.form;
        const {initialValue,label,field,rules,allowClear,placeholder} = this.props;
        const new_props = diffProps(this.props,["form","initialValue","label","field","rules","allowClear","placeholder"]);
        return (
            <Form.Item label={label ? label : "密码输入框"} {...new_props}>
                {getFieldDecorator(field ? field : 'default_password', {initialValue: initialValue,rules: rules ? rules : []})(
                    <Input.Password
                        allowClear={allowClear ? allowClear : true}
                        placeholder={placeholder ? placeholder : "请输入..."}
                    />
                )}
            </Form.Item>
        );
    }
}

export default FormPasswordInput;
